<!--
 * @Author: your name
 * @Date: 2020-12-11 09:54:38
 * @LastEditTime: 2021-01-04 14:51:58
 * @LastEditors: GabbyMrH
 * @Description: In User Settings Edit
 * @FilePath: \vue-element-admind:\lsh_web\uniapp-ts-uview\src\pages\index\index.vue
-->
<template>
  <view class="container">
    <search
      :cityIndex="cityIndex"
      :arrayCity="arrayCity"
      :showaction="showaction"
      @bindPickerChange="bindPickerChange"
    ></search>
    <swiper :list="swiperList"></swiper>
    <noticebar :list="noticelist"></noticebar>
    <quickenter
      :quickenterlist="quickenterlist"
      :borders="border"
      @navto="navto"
    ></quickenter>
    <memberdisplay></memberdisplay>
    <activity :show_line="show_line"></activity>
  </view>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import Search from "./components/search.vue";
import swiper from "./components/swiper.vue";
import noticebar from "./components/noticebar.vue";
import quickenter from "./components/quickenter.vue";
import memberdisplay from "./components/memberdisplay.vue";
import activity from "./components/activity.vue";
import { login } from "@/api/login.ts";

@Component({
  name: "index",
  components: {
    Search,
    swiper,
    noticebar,
    quickenter,
    memberdisplay,
    activity,
  },
})
export default class extends Vue {
  private current: number = 2;
  private toJSON: string = "";
  private cityIndex: Number = 0;
  private arrayCity: string[] = ["深圳市", "上海市"];
  private showaction: boolean = false;

  private swiperList: Array<any> = [
    {
      image: "https://cdn.uviewui.com/uview/swiper/1.jpg",
    },
    {
      image: "https://cdn.uviewui.com/uview/swiper/2.jpg",
    },
    {
      image: "https://cdn.uviewui.com/uview/swiper/3.jpg",
    },
  ];
  private quickenterlist: Array<any> = [
    {
      title: "活动动态",
      img: "../../../static/huodondongtai.png",
      style: "img",
    },
    {
      title: "资源圈",
      img: "../../../static/ziyuanquan.png",
      style: "img",
    },
    {
      title: "蠡有动态",
      img: "../../../static/liyouhudong.png",
      style: "img",
    },
    {
      title: "紧急供求",
      img: "../../../static/jingjigongqiu.png",
      style: "img",
    },
    {
      title: "申请入会",
      img: "../../../static/shengqingruhui.png",
      style: "img",
    },
  ];

  private noticelist: Array<string> = [
    "寒雨连江夜入吴",
    "平明送客楚山孤",
    "洛阳亲友如相问",
    "一片冰心在玉壶",
  ];
  borders: Boolean = false;
  show_line: Boolean = false;

  created(): void {
    console.log("生命周期created触发了");
  }

  onShow(): void {
    console.log("show", this.borders);
  }

  onLoad(): void {
    console.log("load", this.borders);
    uni.login({
      provider: "weixin",
      success: (res: any) => {
        const param = {code:res.code}
        login(param as any).then((res)=>{
          console.log('res',res)
        })


      },
    });
  }

  private bindPickerChange(val: Number) {
    this.cityIndex = val;
  }
  private navto(val: number) {
    console.log("val", val);
  }
}
</script>

<style lang="scss" >
page {
  background: #f2f2f2;
}
</style>